import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { CompanyGovernanceComponent } from './companyGovernance.component';
import { CompanyGovernanceSummaryComponent } from './components/companyGovernanceSummary/companyGovernanceSummary.component';
import { GovernanceInsightsComponent } from './insights/governanceInsights.component';
import { CompanyGovernanceService } from './companyGovernance.service';
import { PipesModule } from '../../../../shared/pipes/pipes.module';
import { CompanyGovernanceIssueComponent } from './components/companyGovernanceIssue/companyGovernanceIssue.component';
import { CompanyGovernanceIndicatorComponent } from './components/companyGovernanceIndicator/companyGovernanceIndicator.component';
import { ChartsModule } from '../../../../shared/directives/charts.module';
import { CompanyReportDownloadModule } from '../shared/companyHeader/companyReportDownload/companyReportDownload.module';
import { ModalModule } from '../../../../shared/components/modal/modal.module';


const routes: Routes = [
    {
        path: '',
        component: CompanyGovernanceComponent,
        children: [
            { path: '', redirectTo: 'summary', pathMatch: 'full' },
            {
                path: 'summary', component: CompanyGovernanceSummaryComponent, data:{
                    showAsMenu: true,
                    enabled: true,
                    menuItems: [{
                        title: 'Summary',
                        path: ['governance', 'summary']
                    }]
                }
            },
            {
                path: 'issue/:number', component: CompanyGovernanceIssueComponent, data: {
                    showAsMenu: true,
                    enabled: true //TODO: set claims if required and on menuItems update call enableMenuRoutes
                }
            }
        ]
    },
    { loadChildren: './companyGovernance.widget#WidgetModule' } //added to route so we generate a chunk for it
]

/**
 * Company governance module
 *
 * Author: Sorin Spiru
 * Date: 13.01.2018
 */
@NgModule({    
    imports:[
        CommonModule,
        FormsModule,
        PipesModule,
        ChartsModule,
        ModalModule,
        CompanyReportDownloadModule,
        RouterModule.forChild(routes)
    ],
    declarations: [
        CompanyGovernanceComponent,
        CompanyGovernanceSummaryComponent,
        CompanyGovernanceIndicatorComponent,
        CompanyGovernanceIssueComponent,
        GovernanceInsightsComponent
    ]
})
export class CompanyGovernanceModule { }
